package com.zhuxulin.android.test.PageTextView;

import com.zhuxulin.android.test.R;
import com.zhuxulin.android.widget.PageTextView;

import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity implements OnClickListener {
	private Button mBtnNext;
	private Button mBtnPrev;
	private PageTextView mTextView02;
	private static int sCount = 10;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.a_page_text_view);
		init();
	}

	private void init() {
		// TODO Auto-generated method stub
		mBtnNext = (Button) findViewById(R.id.next);
		mBtnPrev = (Button) findViewById(R.id.prev);
		mTextView02 = (PageTextView) findViewById(R.id.switcher02);
		mTextView02.setText("Hello world!");
		mBtnPrev.setOnClickListener(this);
		mBtnNext.setOnClickListener(this);
	}

	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
		switch (arg0.getId()) {
		case R.id.next:
			mTextView02.next();
			sCount++;
			break;
		case R.id.prev:
			mTextView02.previous();
			sCount--;
			break;
		}
		mTextView02.setText(sCount % 2 == 0 ? sCount + "AAFirstAA" : sCount + "BBBBBBB");
		System.out.println("getH: [" + mTextView02.getHeight() + "]");

	}
}